package com.feihao.zhou.dao;

import com.feihao.zhou.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

public interface AccountDao {
    //新增：
    @Insert("insert into account values(null,#{name},#{money})")
    Integer save(Account account);

    //删除
    @Delete("delete from account where id=#{id}")
    Integer delete(Integer id);

    //查询所有：
    @Select("select * from account")
    List<Account> findAll();

    //根据id查询

    @Select("select * from account where id=#{id}")
    Account findById(Integer id);

    //修改：
    @Update("update account set name=#{name},money=#{money} where id=#{id}")
    Integer update(Account account);

}
